/*******************************************************************************
*  Project      : Minigate Golfin                                 
*  Program ID   : index.js                                 
*  Description  : 메인
*
********************************************************************************
*  Program History                                                            
*  Date        Author    Description                                          
*  ----------  --------  -------------------------------------------------------- 
*  2012-05-21  김효순    Created.  
*******************************************************************************/

jQuery(function($){
	// 골프인 투데이
	function clsGolfinToday()
	{
		this._init();
	}
	
	clsGolfinToday.prototype = {
		_init: function(){
			var $layer = $("header span.today");
			var today = new Date();
			
			//$layer.html(today.getFullYear() + "." + ("00" + (today.getMonth()+1)).substrEx(-2) + "." + ("00" + today.getDate()).substrEx(-2));
		}
	}
	
	// 조인룸 리스트
	function clsJoinroomList()
	{
		this._HTMLDom = null;
		this.listData = null;
		
		this._init();
	}
	
	clsJoinroomList.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_left article.joinroom");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("ul.joinlist li:first").clone(true)
			}
			
			this.setList([]);
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];
		}
		, setList: function(thisData){
			this.listData = thisData;
			this.display();
		}
		, setJoinList: function(key, thisData){
			for(var i=0;i<this.listData.length;i++){
				if(this.listData[i]["조인룸코드"]+"" == key+"") break;
			}
			
			if(i < this.listData.length){
				this.listData[i]["참여자"] = thisData;
				this.displayJoin(i);
			}
		}
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			$layer.find("ul.joinlist").empty();
			for(var i=0;i<this.listData.length;i++){
				$layer.find("ul.joinlist").append($element.clone(true));
			}
			
			$layer.find("ul.joinlist>li").each(function(n){
				var d = thisClass.listData[n];
				
				$(this).find("div.fl p:eq(0)").html(d["부킹일"] + "(" + d["요일"] + ") " + d["부킹시"]);
				$(this).find("div.fl p:eq(1)").html(d["골프장코스"] + "<sapn class='ff_normal'>" + d["홀"] + "H</span>");
				$(this).find("div.fr p:eq(0)").html(d["닉네임"]);
				$(this).find("div.fr p:eq(1)").html(d["내용"]);
				$(this).find("div.fr ol.person li").attr("class", "off");
			});
		}
		, displayJoin: function(n){
			var $layer = this.$getLayer();
			var $obj = $layer.find("ol.person").eq(n);
			var d = this.listData[n]["참여자"];
			var thisClass = this;
			
			$obj.hover(function(){
				if(d.length > 0) _gf.showMemberLayer($(this), d, "left", 0, $(this).height());
			}, function(){
				_gf.closeMemberLayer();
			});
			$obj.find("li").filter(":lt(" + this.listData[n]["참여자"].length + ")").removeClass("off").addClass("on");
		}
		, spinStart: function(){
			var $layer = this.$getLayer();
			
			$layer.find("ul.joinlist").hide();
			if($layer.find("div#tmpSpin").length == 0){
				$layer.append("<div id='tmpSpin' style='position:relative; width:300px; height:150px;'></div>");
			}
			$layer.find("div#tmpSpin").spin().show();
		}
		, spinEnd: function(){
			var $layer = this.$getLayer();
			
			$layer.find("div#tmpSpin").spin(false).hide();
			$layer.find("ul.joinlist").show();
		}
		, getKey: function(n){
			return this.listData[n]["조인룸코드"];
		}
	}
	
	// 주말 부킹 탭
	function clsWeekendBookingTab()
	{
		this._HTMLDom = null;
		this.idx = null;
		
		this._init();
	}
	
	clsWeekendBookingTab.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_left article.booking div.tab01");
			this._HTMLDom = {
				"$layer": $layer
			}
			
			this.setIdx(0);
		}
		, $getLayer: clsJoinroomList.prototype.$getLayer
		, setIdx: function(n){
			this.idx = n;
			this.display();
		}
		, getIdx: function(){
			return this.idx;
		}
		, display: function(){
			var $layer = this.$getLayer();
			
			$layer.find("li").attr("class", "").eq(this.idx).addClass("on");
		}
	}
	
	// 주말부킹
	function clsWeekendBookingList()
	{
		this._HTMLDom = null;
		this.listData = null;
		this.iTimer = null;
		this.rollF = null;
		this.virtualMode = null;
		
		this._init();
	}
	
	clsWeekendBookingList.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_left div.booking_block:eq(0)");
			$layer.css({
				"overflow": "hidden"
				, "position": "relative"
			});
			$layer.find("div.booking_area:first, ul.bookinglist:first").css("position", "absolute");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("div.booking_area:first, ul.bookinglist:first").clone(true)
				, "$element1": $layer.find("ul.bookinglist:first li:first").clone(true)
			}
			
			this.setList([]);
		}
		, $getLayer: clsJoinroomList.prototype.$getLayer
		, setList: function(thisData){
			this.listData = thisData;
			this.display();
		}
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var $element1 = this._HTMLDom["$element1"];
			var thisClass = this;
			
			this.rollAgree = false;
			$layer.show();
			
			var imgA = {
				1: "/images/btn/btn_area_c.png"
				, 2: "/images/btn/btn_area_m.png"
				, 3: "/images/btn/btn_area_s.png"
			}
			
			$layer.empty();
			for(var i=0;i<this.listData.length;i++){
				$layer.append($element.clone(true));
			}
			
			var showIdx = -1;
			var rollAgree = false;
			
			$layer.find("div.booking_area").each(function(n){
				var d = thisClass.listData[n];
				var $s = $layer.find("ul.bookinglist").eq(n);
				$(this).attr("data-idx", n);
				
				$(this).find("p.area").html("<img src='" + imgA[d["지역코드"]] + "' />");
				$(this).find("p.place").html(d["골프장명"]);
				
				
				$s.empty();
				for(var i=0;i<d["코스리스트"].length;i++){
					$s.append($element1.clone(true));
				}
				
				$s.children("li").each(function(n1){
					var d1 = d["코스리스트"][n1];
					
					$(this).find("div.day").html(d1["예약가능일"].substrEx(4, 2) + "." + d1["예약가능일"].substrEx(6, 2) + "(" + d1["요일"] + ")");
					$(this).find("p.cource").html(d1["코스명"]);
					
					var $tmp = $(this).find("p.team span:eq(0)").children().clone(true);
					
					$(this).find("p.team span:eq(0)").html(d1["오전"] + "팀").prepend($tmp);
					
					$tmp = $(this).find("p.team span:eq(1)").children().clone(true);
					$(this).find("p.team span:eq(1)").html(d1["오후"] + "팀").prepend($tmp);
				});

				var t = 0;
				if(n){
					t = $(this).height()*n + 10;
					
					$layer.find("ul.bookinglist:lt(" + n + ")").each(function(){
						t += $(this).height();
					});
				}
				$(this).css({
					"top": t
				});
				
				$s.css({
					"top": t + $(this).height()+10
				});
				
				$s.css("cursor", "pointer");
				
				var lp = t + $(this).height() + $s.height();
				
				if(lp > $layer.height()){
					rollAgree = true;
					
					if(showIdx < 0) showIdx = n;
				}
			});
			
			$layer.find("div.booking_area:gt(" + showIdx + ")").hide();
			$layer.find("ul.bookinglist:gt(" + showIdx + ")").hide();
			
			if(this.listData.length == 1){
				this.virtualMode = true;
				
				var $c = $layer.find("div.booking_area").clone(true);
				var $s = $layer.find("div.booking_area").next("ul.bookinglist").clone(true);
				
				$layer.append($c).append($s);
				
				var p1 = $layer.find("div.booking_area:first").next("ul.bookinglist").position();
				
				$c.css("top", p1["top"] + $layer.find("div.booking_area:first").next("ul.bookinglist").height());
				$s.css("top", $c.position()["top"] + $c.height());
			}
			
			
			//this.roll();
//			$layer.find("ul.bookinglist>li").each(function(n){
//				var d = thisData[n];
//				
//				$(this).find("div:eq(0)").html(d["날짜"] + "(" + d["요일"] + ")");
//				$(this).find("div:eq(1) p:eq(0)").html(d["골프장명"] + "<span>" + d["코스명"] + "</span>");
//				$(this).find("div:eq(1) p:eq(1) span:eq(0)").html(d["오전"]);
//				$(this).find("div:eq(1) p:eq(1) span:eq(1)").html(d["호후"]);
//			});

			this.rollF = true;
			if(rollAgree) this.roll();
		}
		, setOrder: function(mIdx){
			var $layer = this.$getLayer();
			var $mo = $layer.find("div.booking_area[data-idx=" + mIdx + "]");
			var nIdx = mIdx + 1;
			
			if(nIdx >= this.listData.length) nIdx = 0;
			var $to = $layer.find("div.booking_area[data-idx=" + nIdx + "]");
			
			var t = $mo.position()["top"] + $mo.height() + $mo.next("ul.bookinglist").height() + 10;
			
			$to.show().css("top", t);
			$to.next("ul.bookinglist").show().css("top", t + $to.height() + 10);
		}
		, roll: function(){
			var $layer = this.$getLayer();
			var thisClass = this;
			
			if(this.iTimer) clearTimeout(this.iTimer);
			
			this.iTimer = setTimeout(function(){
				thisClass.roll();
			}, 50);
			
			if(!this.rollF) return;
			
			if(this.virtualMode){
				
			}else{
				var mIdx = -1;
				var mt = 0;
				
				$layer.find("div.booking_area:visible").each(function(n){
					var p = $(this).position();
					var ap = $(this).next("ul.bookinglist").position();
					
					$(this).css("top", p["top"] - 1);
					$(this).next("ul.bookinglist").css("top", ap["top"] - 1);
					
					var mp = p["top"] - 1 + $(this).height() + $(this).next("ul.bookinglist").height();
					
					if(mp < 0){
						$(this).hide();
						$(this).next("ul.bookinglist").hide();
					}
					
					if(mt < mp){
						mIdx = $(this).attr("data-idx");
						mt = mp;
					}
				});
				
				if((mt > $layer.height() && mt < $layer.height()+3) && mIdx > -1) thisClass.setOrder(parseInt(mIdx));
			}
		}
		, spinStart: function(){
			var $layer = this.$getLayer();
			
			$layer.show();
			$layer.children().hide();
			if($layer.find("div#tmpSpin").length == 0){
				$layer.append("<div id='tmpSpin' style='position:relative; width:300px; height:" + $layer.height() + "px;' />");
			}
			$layer.find("div#tmpSpin").show().spin();
		}
		, spinEnd: function(){
			var $layer = this.$getLayer();
			
			$layer.children().show();
			$layer.find("div#tmpSpin").hide().spin(false);
		}
		, getAreaKey: function(n){
			return this.listData[n]["지역코드"];
		}
		, getGolfKey: function(n){
			return this.listData[n]["골프장코드"];
		}
		, getCourseKey: function(i, n){
			return this.listData[i]["코스리스트"][n]["코스코드"]
		}
		, getDate: function(i, n){
			var d = this.listData[i]["코스리스트"][n]["예약가능일"];
			
			return new Date(d.substrEx(0, 4), d.substrEx(4, 2)-1, d.substrEx(6, 2));
		}
		, setRollF: function(val){
			this.rollF = val;
		}
		, hide: function(){
			var $layer = this.$getLayer();
			
			if(this.iTimer) clearTimeout(this.iTimer);
			
			$layer.hide();
		}
	}
	
	// 추천부킹
	function clsRecommBookingList()
	{
		this._HTMLDom = null;
		this.listData = null;
		
		this.iTimer = null;
		this.rollF = null;
		
		this._init();
	}
	
	clsRecommBookingList.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_left div.booking_block:eq(1)");
			$layer.css({
				"overflow": "hidden"
				, "position": "relative"
			});
			$layer.find("ul.bookinglist_push").css("position", "absolute");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("li:first").clone(true)
			}
			
			$layer.hide();
		}
		, $getLayer: clsJoinroomList.prototype.$getLayer
		, setList: function(thisData){
			this.listData = thisData;
			this.display();
		}
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			var imgA = {
				1: "/images/btn/btn_area_c.png"
				, 2: "/images/btn/btn_area_m.png"
				, 3: "/images/btn/btn_area_s.png"
			}
			
			$layer.show();
			
			$layer.find("ul.bookinglist_push").empty();
			for(var i=0;i<this.listData.length;i++){
				$layer.find("ul.bookinglist_push").append($element.clone(true));
			}
			
			$layer.find("ul.bookinglist_push>li").each(function(n){
				$(this).attr("data-idx", n).css("cursor", "pointer");
				var d = thisClass.listData[n];
				
				$(this).find("div.fl").html('<p class="area"><img src="' + imgA[d["지역코드"]] + '" /></p>' + d["예약일"].substrEx(4, 2) + "." + d["예약일"].substrEx(6, 2) + '(' + d["요일"] + ')');
				$(this).find("p.place").html(d["골프장명"]);
				$(this).find("p.cource").html(d["코스명"] + "<span>" + d["홀"] + "H</span>");
				$(this).find("p.coin span").html("&#92;" + _util.number_format(d["그린피"]));
			});
			
			
			
			var rollAgree = false;
			if($layer.find("ul.bookinglist_push").height() > $layer.height()) rollAgree = true;
			
			this.rollF = true;
			if(rollAgree) this.roll();
		}
		, spinStart: clsWeekendBookingList.prototype.spinStart
		, spinEnd: clsWeekendBookingList.prototype.spinEnd
		, setOrder: function(){
			var $layer = this.$getLayer();
			var $o = $layer.find("ul.bookinglist_push>li:first");
			var $c = $layer.find("ul.bookinglist_push>li:first").clone(true);
			
			$o.remove();
			$layer.find("ul.bookinglist_push").append($c);
			$layer.find("ul.bookinglist_push").css("top", 0);
		}
		, roll: function(){
			var $layer = this.$getLayer();
			var thisClass = this;
			
			if(this.iTimer) clearTimeout(this.iTimer);
			
			this.iTimer = setTimeout(function(){
				thisClass.roll();
			}, 50);
			
			if(!this.rollF) return;
			
			var p = $layer.find("ul.bookinglist_push").position();
			
			$layer.find("ul.bookinglist_push").css("top", p["top"]-1);
			
			if($layer.find("ul.bookinglist_push").position()["top"] + $layer.find("ul.bookinglist_push>li:first").height() < -21) this.setOrder();
		}
		, getReserveKey: function(n){
			return this.listData[n]["예약코드"];
		}
		, getAreaKey: function(n){
			return this.listData[n]["지역코드"];
		}
		, getGolfKey: function(n){
			return this.listData[n]["골프장코드"];
		}
		, getCourseKey: function(n){
			return this.listData[n]["코스코드"]
		}
		, getDate: function(n){
			var d = this.listData[n]["예약일"];
			
			return new Date(d.substrEx(0, 4), d.substrEx(4, 2)-1, d.substrEx(6, 2));
		}
		, setRollF: function(val){
			this.rollF = val;
		}
		, hide: function(){
			var $layer = this.$getLayer();
			
			if(this.iTimer) clearTimeout(this.iTimer);
			
			$layer.hide();
		}
	}
	
	// 본문탭
	function clsArticleTab()
	{
		this._HTMLDom = null;
		this.idx = null;
		
		this._init();
	}
	
	clsArticleTab.prototype = {
		_init: function(){
			var $layer = $("ul.tab02");
			this._HTMLDom = {
				"$layer": $layer
			}
			
			this.setIdx(0);
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];
		}
		, setIdx: function(n){
			this.idx = n;
			this.display();
		}
		, display: function(){
			var $layer = this.$getLayer();
			
			var src = $layer.find("img").eq(this.idx).attr("src");
			$layer.find("li").attr("class", "").eq(this.idx).addClass("on");
			$layer.find("img").each(function(){
				var src = $(this).attr("src");
				$(this).attr("src", src.replace("_on", ""));
			});
			
			var src = $layer.find("img").eq(this.idx).attr("src");
			$layer.find("img").eq(this.idx).attr("src", src.replace(".gif", "_on.gif"));
		}
		, getIdx: function(){
			return this.idx;
		}
	}
	
	// 골프인 페이스북
	function clsFacebook()
	{
		this._HTMLDom = null;
		
		this._init();
	}
	
	clsFacebook.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_right article.tablist:eq(0)");
			this._HTMLDom = {
				"$layer": $layer
			}
			
			$layer.hide();
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];
		}
		, show: function(){
			this.$getLayer().show();
		}
		, hide: function(){
			this.$getLayer().hide();
		}
		, spinStart: function(){
			
		}
		, spinEnd: function(){
			
		}
	}
	
	// 동호회 최신글
	function clsClubArticleList()
	{
		this._HTMLDom = null;
		this.listData = null;
		
		this._init();
	}
	
	clsClubArticleList.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_right article.tablist:eq(1)");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("li:first").clone(true)
			}
			this._HTMLDom["$element"].find("p:first img").width(50).height(50);
			
			$layer.next("div.round_box").remove();
			
			$layer.hide();
			this.setList([]);
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];
		}
		, setList: function(thisData){
			this.listData = thisData;
			this.display();
		}
		, setWriter: function(boardKey, infoData, posKey){
			for(var i=0;i<this.listData.length;i++){
				var obj = this.listData[i];
				
				if(obj["글코드"]+"" == boardKey+""){
					if(!posKey) break;
					else if(obj["게시판종류"] == posKey) break;
				}
			}
			
			if(i<this.listData.length){
				var d = this.listData[i];
				
				d["작성자"] = infoData;
				this.displayWriter(i);
			}
		}
		, setNiceshotList: function(boardKey, thisData, posKey){
			for(var i=0;i<this.listData.length;i++){
				var obj = this.listData[i];
				
				if(obj["글코드"]+"" == boardKey+""){
					if(!posKey) break;
					else if(obj["게시판종류"] == posKey) break;
				}
			}
			
			if(i<this.listData.length){
				var d = this.listData[i];
				
				d["나이스샷"] = thisData;
				this.displayNiceshot(i);
			}
		}
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			$layer.find("ul:first").empty();
			for(var i=0;i<this.listData.length;i++){
				$layer.find("ul:first").append($element.clone(true));
			}
			$layer.find("ul:first>li").each(function(n){
				var d = thisClass.listData[n];
				
				$(this).find("p:first img").attr("src", _gf.getDefaultProfileImage());
				$(this).find("span.nickname").html(d["작성자"]["닉네임"]);
				$(this).find("span.club").html(d["동호회명"]);
				$(this).find("dd:eq(0)").html(d["제목"]);
				$(this).find("dd.num li:eq(0)").html("<em>등록일</em> " + d["등록일"]);
				$(this).find("dd.num li:eq(1) em").html(d["조회수"]);
				$(this).find("dd.num li:eq(2) em").html("(0)");
			});
		}
		, displayWriter: function(n){
			var $layer = this.$getLayer();
			var thisData = this.listData[n]["작성자"];
			
			$layer.find("ul:first>li").eq(n).find("p:first img").attr("src", _gf.filePath2Url(this.listData[n]["작성자"]["이미지"])).error(function(){
				$(this).attr("src", _gf.getDefaultProfileImage());
			});
			$layer.find("ul:first>li").eq(n).find("span.nickname").hover(function(){
				_gf.showProfileLayer($(this), thisData, "left", 0, $(this).height());
			}, function(){
				_gf.closeProfileLayer();
			});
		}
		, displayNiceshot: function(n){
			var $layer = this.$getLayer();
			var thisData = this.listData[n]["나이스샷"];
			
			$layer.find("ul:first>li").eq(n).find("dd.num li:eq(2) em").html("(" + thisData.length + ")").hover(function(){
				if(thisData.length) _gf.showMemberLayer($(this), thisData, "right", -145, $(this).height());
			}, function(){
				_gf.closeMemberLayer();
			});
		}
		, spinStart: function(){
			var $layer = this.$getLayer();
			
			$layer.find("div.list_new").hide();
			if($layer.find("div#tmpSpin").length == 0){
				$layer.append("<div id='tmpSpin' style='position:relative; width:430px; height:150px;'></div>");
			}
			$layer.find("div#tmpSpin").show().spin();
		}
		, spinEnd: function(){
			var $layer = this.$getLayer();
			
			$layer.find("div.list_new").show();
			$layer.find("div#tmpSpin").hide().spin(false);
		}
		, show: function(){
			this.$getLayer().show();
		}
		, hide: function(){
			this.$getLayer().hide();
		}
		, getKey: function(n){
			return this.listData[n]["글코드"];
		}
		, getClubKey: function(n){
			return this.listData[n]["동호회코드"];
		}
		, getArticleType: function(n){
			return this.listData[n]["게시판종류"];
		}
	}
	
	// 나이스샷
	function clsNiceshotList(){
		this._HTMLDom = null;
		this.listData = null;
		
		this._init();
	}
	
	clsNiceshotList.prototype = {
		_init: function(){
			var $layer = $("div#container section#index_content_right article.tablist:eq(2)");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("li:first").clone(true)
			}
			
			this._HTMLDom["$element"].find("p:first img").width(50).height(50);
			
			$layer.hide();
			this.setList([]);
		}
		, $getLayer: clsClubArticleList.prototype.$getLayer
		, setList:clsClubArticleList.prototype.setList
		, setWriter: clsClubArticleList.prototype.setWriter
		, setNiceshotList: clsClubArticleList.prototype.setNiceshotList
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			$layer.find("ul:first").empty();
			for(var i=0;i<this.listData.length;i++){
				$layer.find("ul:first").append($element.clone(true));
			}
			$layer.find("ul:first>li").each(function(n){
				var d = thisClass.listData[n];
				var cName = "";
				if(d["게시판종류"] == "K") cName = "course";
				else cName = "club";
				
				$(this).find("p:first img").attr("src", _gf.getDefaultProfileImage());
				$(this).find("span.nickname").html(d["작성자"]["닉네임"]);
				$(this).find("span.nickname").next("span").attr("class", cName).html(d["위치"]);
				$(this).find("dd:eq(0)").html(d["제목"]);
				$(this).find("dd.num li:eq(0)").html("<em>등록일</em> " + d["등록일"]);
				$(this).find("dd.num li:eq(1) em").html(d["조회수"]);
				$(this).find("dd.num li:eq(2) em").html("(0)");
			});
		}
		, displayWriter: clsClubArticleList.prototype.displayWriter
		, displayNiceshot: clsClubArticleList.prototype.displayNiceshot
		, spinStart: clsClubArticleList.prototype.spinStart
		, spinEnd: clsClubArticleList.prototype.spinEnd
		, show:clsClubArticleList.prototype.show
		, hide: clsClubArticleList.prototype.hide
		, getArticleType: clsClubArticleList.prototype.getArticleType
		, getKey: clsClubArticleList.prototype.getKey
		, getClubKey: clsClubArticleList.prototype.getClubKey
	}
	
	// 공지사항
	function clsNoticeList()
	{
		this._HTMLDom = null;
		this.listData = null;
		this.idx = null;
		this.iTimer = null;
		
		this.rollF = null;
		
		this._init();
	}
	
	clsNoticeList.prototype = {
		_init: function(){
			var $layer = $("header h4.group");
			$layer.find("img[alt='이전글'], img[alt='다음글']").hide();
			
			$layer.css({
				"overflow": "hidden"
				, "position": "relative"
			});
			$layer.find("p.top_notice").css("position", "absolute");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("p.top_notice").clone(true)
				, "element_height": $layer.find("p.top_notice").height()
			}
			
			this.setList([]);
			this.idx = 0;
		}
		, $getLayer: clsClubArticleList.prototype.$getLayer
		, setList:clsClubArticleList.prototype.setList
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			$layer.find("p.top_notice").remove();
			for(var i=0;i<this.listData.length;i++){
				$layer.append($element.clone(true));
			}
			$layer.find("p.top_notice").each(function(n){
				var d = thisClass.listData[n];
				var t = $layer.height()*n;
				
				$(this).css({
					"top": t
				});
				
				$(this).css("cursor", "pointer");
				
				$(this).find("span.notice").html(d["제목"]);
				$(this).find("span.date").html(d["등록일"]);
			});
			
			this.rollF = true;
			this.iTimer = setTimeout(function(){
				thisClass.roll();
			}, 3000);
		}
		, setOrder: function(n){
			var $layer = this.$getLayer();
			var mt = 0;
			var $o = $layer.find("p.top_notice").eq(n);
			
			$layer.find("p.top_notice").each(function(n){
				var p = $(this).position();
				
				if(p["top"] > mt) mt = p["top"];
			});
				
			$o.css({
				"top": mt + $layer.height()
			});
		}
		, roll: function(){
			var $layer = this.$getLayer();
			var thisClass = this;
			
			if(this.iTimer) clearTimeout(this.iTimer);
			
			this.iTimer = setTimeout(function(){
				thisClass.roll();
			}, 50);
			
			if(!this.rollF) return;
			
			if(this.listData.length > 1){
				$layer.find("p.top_notice").each(function(n){
					var p = $(this).position();
					
					$(this).css("top", p["top"] - 1);
					
					if(p["top"]-1 < $layer.height()*-1){
						thisClass.setOrder(n);
						clearTimeout(thisClass.iTimer);
						
						thisClass.iTimer = setTimeout(function(){
							thisClass.roll();
						}, 3000);
					}
				});
			}
		}
		, spinStart: function(){
			var $layer = this.$getLayer();
			
			$layer.find("table").hide();
			if($layer.find("div#tmpSpin").length == 0){
				$layer.append("<div id='tmpSpin' style='position:relative; width:430px; height:150px;'></div>");
			}
			$layer.find("div#tmpSpin").show().spin();
		}
		, spinEnd: function(){
			var $layer = this.$getLayer();
			
			$layer.find("table").show();
			$layer.find("div#tmpSpin").hide().spin(false);
		}
		, getKey: function(n){
			return this.listData[n]["글코드"];
		}
		, setRollF: function(val){
			this.rollF = val;
		}
	}
	
	function clsComm()
	{
		
		this._init();
	}
	
	clsComm.prototype = {
		_init: function(){

		}
		// 조인룸 리스트
		, getJoinroomList: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getJoinRoomList";
			var options = {

			}
			document.objGlobal.ajax({
				"sid":"JR001"
				, "servicename":serviceName
				, "listcount":2
				, "currpageno":1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						if(i > 1) break;
						var obj = items[i];
						var reserveDate = _util.nvl(obj["reserveDate"])+"";
						
						res["결과값"].push({
							"조인룸코드": _util.nvl(obj["joinRoomSeq"])
							, "닉네임": _util.nvl(obj["nickName"])
							, "부킹일": reserveDate.substrEx(-5)
							, "부킹시": _util.nvl(obj["bookingTime"])
							, "요일": _util.nvl(obj["bookingDay"])
							, "골프장코스": _util.nvl(obj["golfClubInfo"])
							, "홀": _util.nvl(obj["holeInfo"])
							, "참여자": [
								
							]
							, "신청자": [
								
							]
							, "내용": _util.nvl(obj["ment"])
						});
					}
				}
				
				document.objControl.finishJoinroomList(res);
			});
		}
		// 참여자
		, getJoinList: function(arg){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMemberList";
			var options = {
				"joinRoomSeq": arg["조인룸코드"]
			}
			document.objGlobal.ajax({
				"sid": "JR001"
				, "servicename": "getMemberList"
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "조인룸코드": arg["조인룸코드"]
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						
						res["결과값"].push({
							"아이디": _util.nvl(obj["participantId"])
							, "닉네임": _util.nvl(obj["nickName"])
							, "이미지": _util.nvl(obj["path"]) + _util.nvl(obj["saveFileNm"])
						});
					}
				}
				document.objControl.finishJoinList(res);
			});
		}
		// 주말부킹 리스트
		, getWeekendBookingList: function(arg){
			var thisClass = this;
			
			arg = arg || {};
			arg["콜백"] = arg["콜백"] || function(){};
			
			var t = new Date();
//			var diff = 6-t.getDay();
//			
//			switch(diff){
//				case 0:
//					t.setDate(t.getDate()+7);
//					break;
//				case 6:
//					t.setDate(t.getDate()+6);
//					break;
//				default:
//					t.setDate(t.getDate()+diff);
//					break;
//			}
			
			//ajax
			var serviceName = "reservSearchList";
			var options = {
				"search_date_main": t.getFullYear() + ("00" + (t.getMonth()+1)).substrEx(-2) + ("00" + t.getDate()).substrEx(-2)
				, "search": ""
				, "region": ""
			}
			_gf.ajax({
				"sid": "RS001"
				, "servicename": serviceName
				, "listcount": 1000
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var reserv_date = _util.nvl(obj["reserv__date"])+"";
						
						if(!_util.nvl(obj["mor"]) && !_util.nvl(obj["aft"])) continue;
						
						for(j=0;j<res["결과값"].length;j++){
							if(res["결과값"][j]["골프장코드"] == _util.nvl(obj["golfclub__id"])) break;
						}
						
						if(j<res["결과값"].length){
							res["결과값"][j]["코스리스트"].push({
								"코스코드": _util.nvl(obj["course__info__id"])
								, "코스명": _util.nvl(obj["course__info__name"])
								, "예약가능일": reserv_date
								, "요일": _util.nvl(obj["reserv__day"])
								, "오전": _util.nvl(obj["mor"], 0)
								, "오후": _util.nvl(obj["aft"], 0)
							});
						}else{
							res["결과값"].push({
								"골프장코드": _util.nvl(obj["golfclub__id"])
								, "골프장명": _util.nvl(obj["golfclub__name"])
								, "지역코드": _util.nvl(obj["region"])
								, "코스리스트": [{
									"코스코드": _util.nvl(obj["course__info__id"])
									, "코스명": _util.nvl(obj["course__info__name"])
									, "예약가능일": reserv_date
									, "요일": _util.nvl(obj["reserv__day"])
									, "오전": _util.nvl(obj["mor"], 0)
									, "오후": _util.nvl(obj["aft"], 0)
								}]
							});
						}
					}
				}
				
				arg["콜백"].apply(null, [res]);
			});
		}
		// 추천 부킹 리스트
		, getRecommBookingList: function(arg){
			var thisClass = this;
			
			arg = arg || {};
			arg["콜백"] = arg["콜백"] || function(){};
			
			//ajax
			var serviceName = "reservSuggestList";
			var options = {
				
			}
			_gf.ajax({
				"sid": "RS001"
				, "servicename": serviceName
				, "listcount": 5
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var reserv_date = _util.nvl(obj["reserv__date"])+""
						
						res["결과값"].push({
							"예약코드": _util.nvl(obj["reserv__seq"])
							, "지역코드": _util.nvl(obj["region"])
							, "예약일": reserv_date
							, "요일": _util.nvl(obj["reserv__day"])
							, "골프장코드": _util.nvl(obj["glofclub__id"])
							, "골프장명": _util.nvl(obj["golfclub__name"])
							, "코스코드": _util.nvl(obj["course__info__id1"])
							, "코스명": _util.nvl(obj["course__info__name1"])
							, "홀": _util.nvl(obj["hole"])
							, "그린피": _util.nvl(obj["greenfee"])
						});
					}
				}
				
				arg["콜백"].apply(null, [res]);
			});
		}
		// 동호회 최신글
		, getClubArticleList: function(arg){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMainClubBoardList";
			var options = {
				
			}
			_gf.ajax({
				"sid": "MB001"
				, "servicename": serviceName
				, "listcount": 10
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var reg_date = _util.nvl(obj["reg__date"])+"";
						
						res["결과값"].push({
							"글코드": _util.nvl(obj["board__seq"])
							, "동호회코드": _util.nvl(obj["club__seq"])
							, "게시판종류": _util.nvl(obj["board__type"]) // D:일반, P: 사진, K: 코스공략
							, "등록일": reg_date.substrEx(0, 4) + "." + reg_date.substrEx(4, 2) + "." + reg_date.substrEx(6, 2)
							, "동호회명": _util.nvl(obj["club__name"])
							, "제목": _util.nvl(obj["title"])
							, "조회수": _util.nvl(obj["hit"], 0)
							, "작성자": {
								"아이디": _util.nvl(obj["reg__id"])
								, "닉네임": _util.nvl(obj["reg__nickname"])
							}
						});
					}
				}
				document.objControl.finishClubArticleList(res);
			});
		}
		// 인기 동호회
		, getPopClubList: function(arg){
			var thisClass = this;
			
			//ajax
			var serviceName = "getList";
			var options = {
				"scope": 1
				, "categoryId": 0
			}
			_gf.ajax({
				"sid": "CL001"
				, "servicename": serviceName
				, "listcount": 10
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var regDate = _util.nvl(obj["regDate"])+"";
						
						res["결과값"].push({
							"동호회코드": _util.nvl(obj["clubSeq"])
							, "동호회명": _util.nvl(obj["clubName"])
							, "로고파일": _util.nvl(obj["logoUrl"])
							, "내용": _util.nvl(obj["clubDesc"])
							, "개설일": regDate.substrEx(0, 4) + "." + regDate.substrEx(4, 2) + "." + regDate.substrEx(6, 2)
							, "회원수": _util.nvl(obj["memberCnt"], 0)
							, "게시글수": _util.nvl(obj["totalBoardCnt"], 0)
						});
					}
				}
				document.objControl.finishPopClubList(res);
			});
		}
		// 나이스샷 리스트
		, getNiceshotList: function(arg){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMainNiceshotList";
			var options = {
				
			}
			_gf.ajax({
				"sid": "MB001"
				, "servicename": serviceName
				, "listcount": 10
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var reg_date = _util.nvl(obj["reg__date"])+"";
						var posValue = "";
						switch(_util.nvl(obj["board__type"])){
							case "K":
								posValue = "코스공략";
								break;
							case "P":
							case "D":
								posValue = _util.nvl(obj["club__name"]);
								break;
						}
						
						res["결과값"].push({
							"글코드": _util.nvl(obj["board__seq"])
							, "동호회코드": _util.nvl(obj["club__seq"])
							, "게시판종류": _util.nvl(obj["board__type"])
							, "위치": posValue
							, "제목": _util.nvl(obj["title"])
							, "등록일": reg_date.substrEx(0, 4) + "." + reg_date.substrEx(4, 2) + "." + reg_date.substrEx(6, 2)
							, "조회수": _util.nvl(obj["hit"], 0)
							, "나이스샷수": _util.nvl(obj["niceshot"], 0)
							, "작성자": {
								"아이디": _util.nvl(obj["reg__id"])
								, "닉네임": _util.nvl(obj["reg__nickname"])
							}
						});
					}
				}
				document.objControl.finishNiceshotList(res);
			});
		}
		// 나이스샷 회원 리스트
		, getNiceshotMemberList: function(arg){
			var thisClass = this;
			
			//ajax
			var serviceName = "getClubBoardNiceshot";
			var sid = "CB001";
			switch(arg["게시판종류"]){
				case "K":
					serviceName = "getKnowhowBoardNiceshot";
					sid = "KB001"
					break;
			}
			var options = {
				"board_seq": arg["글코드"]
			}
			_gf.ajax({
				"sid": sid
				, "servicename": serviceName
				, "listcount": 10000
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "타겟": arg["타겟"]
					, "글코드": arg["글코드"]
					, "게시판종류": arg["게시판종류"]
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						
						res["결과값"].push({
							"아이디": _util.nvl(obj["reg__id"])
							, "닉네임": _util.nvl(obj["reg__nickname"])
							, "이미지": _util.nvl(obj["user__image"])
						});
					}
				}
				document.objControl.finishNiceshotMemberList(res);
			});
		}
		// 공지사항
		, getNoticeList: function(arg){
			var thisClass = this;
			
			//ajax
			var serviceName = "getNoticeList";
			var options = {
				
			}
			_gf.ajax({
				"sid": "MB001"
				, "servicename": serviceName
				, "listcount": 3
				, "currpageno": 1
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": []
				}
				
				var items = ret["msp"]["contents"]["items"];
				
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var reg_date = _util.nvl(obj["reg__date"])+"";
						
						res["결과값"].push({
							"글코드": _util.nvl(obj["board__seq"])
							, "제목": _util.nvl(obj["title"])
							, "등록일": reg_date.substrEx(0, 4) + "." + reg_date.substrEx(4, 2) + "." + reg_date.substrEx(6, 2)
						});
					}
				}

				document.objControl.finishNoticeList(res);
			});
		}
	}
	
	// 컨트롤
	function clsControl()
	{
		this.objComm = null;
		this.objGolfinToday = null;
		this.objJoinroomList = null;
		this.objWeekendBookingTab = null;
		this.objWeekendBookingList = null;
		this.objRecommBookingList = null;
		this.objArticleTab = null;
		this.objFacebook = null;
		this.objClubArticleList = null;
		this.objNiceshotList = null;
		this.objNoticeList = null;
		
		this.areaCodeList = null;
		
		this._permitStart = null;
	}
	
	clsControl.prototype = {
		_init: function(){
			this._preload();
			
			this.objComm = new clsComm();
			this.objGolfinToday = new clsGolfinToday();
			this.objJoinroomList = new clsJoinroomList();
			this.objWeekendBookingTab = new clsWeekendBookingTab();
			this.objWeekendBookingList = new clsWeekendBookingList();
			this.objRecommBookingList = new clsRecommBookingList();
			this.objArticleTab = new clsArticleTab();
			this.objFacebook = new clsFacebook();
			this.objClubArticleList = new clsClubArticleList();
			this.objNiceshotList = new clsNiceshotList();
			this.objNoticeList = new clsNoticeList();
			
			this._beforeStart();
			this._bind();
		}
		, _preload: function(){
			_gf.spinStart();
		}
		, _beforeStart: function(){
			var thisClass = this;
			this._permitStart = {
				"지역": false
			}
			
			_gf.getAreaCodeList({
				"콜백": function(ret, listData){
					if(ret["메시지"]) alert(ret["메시지"]);
					if(ret["결과코드"] != "00000") return;
					
					thisClass.areaCodeList = listData;
					thisClass._permitStart["지역"] = true;
				}
			});
			
			_util.executeThread(function(){
				for(var k in thisClass._permitStart){
					if(!thisClass._permitStart[k]) return false;
				}
				
				return true;
			}, function(){
				_gf.spinEnd();
				thisClass._start();
			});
		}
		, _bind: function(){
			var thisClass = this;
			
			// 조인룸
			this.objJoinroomList.$getLayer().on("click", "p.tit a", function(){
				document.location.href = "/booking/join_room.html";
			});
			
			// 주말부킹 탭
			this.objWeekendBookingTab.$getLayer().on("click", "li", function(){
				var n = thisClass.objWeekendBookingTab.$getLayer().find("li").index($(this));
				thisClass.objWeekendBookingTab.setIdx(n);
				
				thisClass.getBookingList();
			});
//			this.objWeekendBookingList.$getLayer().on("click", "div.tab01 li", function(){
//				var n = thisClass.objWeekendBookingList.$getLayer().find("div.tab01 li").index($(this));
//
//				thisClass.objWeekendBookingList.setIdx(n);
//			});

			// 주말부킹
			this.objWeekendBookingList.$getLayer().on("mouseenter", null, function(){
				thisClass.objWeekendBookingList.setRollF(false);
			}).on("mouseleave", null, function(){
				thisClass.objWeekendBookingList.setRollF(true);
			}).on("click", "ul.bookinglist li", function(){
				var idx = $(this).parent().prev().attr("data-idx");
				var n = $(this).parent().find("li").index($(this));
				var areaKey = thisClass.objWeekendBookingList.getAreaKey(idx);
				var golfKey = thisClass.objWeekendBookingList.getGolfKey(idx);
				var courseKey = thisClass.objWeekendBookingList.getCourseKey(idx, n);
				var selDate = thisClass.objWeekendBookingList.getDate(idx, n);
				
				thisClass.goReserveListPage(areaKey, golfKey, courseKey, selDate);
			});
			
			// 추천부킹
			this.objRecommBookingList.$getLayer().on("mouseenter", null, function(){
				thisClass.objRecommBookingList.setRollF(false);
			}).on("mouseleave", null, function(){
				thisClass.objRecommBookingList.setRollF(true);
			}).on("click", "li", function(){
				var n = $(this).attr("data-idx");
				var reserveKey = thisClass.objRecommBookingList.getReserveKey(n);
				var areaKey = thisClass.objRecommBookingList.getAreaKey(n);
				var golfKey = thisClass.objRecommBookingList.getGolfKey(n);
				var courseKey = thisClass.objRecommBookingList.getCourseKey(n);
				var selDate = thisClass.objRecommBookingList.getDate(n);
				
				thisClass.goReserveViewPage(reserveKey, areaKey, golfKey, courseKey, selDate);
			});
			
			// 본문탭
			this.objArticleTab.$getLayer().on("click", "img", function(){
				var n = thisClass.objArticleTab.$getLayer().find("img").index($(this));
				
				thisClass.objArticleTab.setIdx(n);
				thisClass.showArticleTab();
			});
			
			// 조인룸 링크
			this.objJoinroomList.$getLayer().on("click", "ul.joinlist>li", function(){
				var n = thisClass.objJoinroomList.$getLayer().find("ul.joinlist>li").index($(this));
				var key = thisClass.objJoinroomList.getKey(n);
				
				thisClass.goJoinroomViewPage(key);
			});
			
			// 동호회 최신글 링크
			this.objClubArticleList.$getLayer().on("click", "div.list_new>ul>li", function(){
				var n = thisClass.objClubArticleList.$getLayer().find("div.list_new>ul>li").index($(this));
				var key = thisClass.objClubArticleList.getKey(n);
				var clubKey = thisClass.objClubArticleList.getClubKey(n);
				var articleType = thisClass.objClubArticleList.getArticleType(n);

				switch(articleType){
					case "D":
						thisClass.goClubBoardViewPage(clubKey, key);
						break;
					case "P":
						thisClass.goClubImageBoardViewPage(clubKey, key);
						break;
				}
			});
			
			// 나이스샷  링크
			this.objNiceshotList.$getLayer().on("click", "div.list_new>ul>li", function(){
				var n = thisClass.objNiceshotList.$getLayer().find("div.list_new>ul>li").index($(this));
				var key = thisClass.objNiceshotList.getKey(n);
				var clubKey = thisClass.objNiceshotList.getClubKey(n);
				var articleType = thisClass.objNiceshotList.getArticleType(n);
				
				switch(articleType){
					case "K":
						thisClass.goCourseViewPage(key);
						break;
					case "D":
						thisClass.goClubBoardViewPage(clubKey, key);
						break;
					case "P":
						thisClass.goClubImageBoardViewPage(clubKey, key);
						break;
				}
			});
			
			// 공지사항
//			this.objNoticeList.$getLayer().on("click", "img[alt='더보기'], tbody tr", function(){
//				var tName = this.tagName.toUpperCase();
//				
//				switch(tName){
//					case "IMG":
//						thisClass.goNoticeListPage();
//						break;
//					case "TR":
//						var n = thisClass.objNoticeList.$getLayer().find("tbody tr").index($(this));
//						var k = thisClass.objNoticeList.getKey(n);
//						
//						thisClass.goNoticeViewPage(k);
//						break;
//				}
//			});

			// 공지사항
			this.objNoticeList.$getLayer().on("mouseenter", null, function(){
				thisClass.objNoticeList.setRollF(false);
			}).on("mouseleave", null, function(){
				thisClass.objNoticeList.setRollF(true);
			}).on("click", "p.top_notice", function(){
				var n = thisClass.objNoticeList.$getLayer().find("p.top_notice").index($(this));
				var k = thisClass.objNoticeList.getKey(n);
				
				thisClass.goNoticeViewPage(k);
			});
			
			
			$("div#container section#index_content_left article.booking p.tit").on("click", "a", function(){
				document.location.href = "/booking/date_reserve.html";
			});
		}
		, _start: function(){
			// 조인룸 리스트
			this.objJoinroomList.spinStart();
			this.objComm.getJoinroomList({
				
			});
			
			// 주말부킹
			this.getBookingList();
//			for(var i=0;i<this.areaCodeList.length;i++){
//				this.objComm.getWeekendBookingList({
//					"지역코드": this.areaCodeList[i]["지역코드"]
//				});
//			}
			
			this.showArticleTab();
			
			// 공지사항 리스트
			this.objNoticeList.spinStart();
			this.objComm.getNoticeList();
		}
		// 본문탭 활성
		, showArticleTab: function(){
			var n = this.objArticleTab.getIdx();
			var objs = [
				{
					"타겟": this.objFacebook
					, "통신": function(){}
				}
				, {
					"타겟": this.objClubArticleList
					, "통신": this.objComm.getClubArticleList
				}
				, {
					"타겟": this.objNiceshotList
					, "통신": this.objComm.getNiceshotList
				}
			]
			
			$.each(objs, function(){
				this["타겟"].hide();
			});
			
			objs[n]["타겟"].show();
			objs[n]["타겟"].spinStart();
			objs[n]["통신"].apply(null);
		}
		// 조인룸 완료
		, finishJoinroomList: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objJoinroomList.spinEnd();
			this.objJoinroomList.setList(ret["결과값"]);
			
			// 참여자 리스트
			for(var i=0;i<ret["결과값"].length;i++){
				var obj = ret["결과값"][i];
				
				this.objComm.getJoinList({
					"조인룸코드": obj["조인룸코드"]
				});
			}
		}
		// 참여자 완료
		, finishJoinList: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objJoinroomList.setJoinList(ret["조인룸코드"], ret["결과값"]);
		}
		// 주말부킹 완료
		, finishWeekendBookingList: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objWeekendBookingList.spinEnd();
			
			this.objWeekendBookingList.setList(ret["결과값"]);
		}
		// 추천부킹 완료
		, finishRecommBookingList: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objRecommBookingList.spinEnd();
			
			this.objRecommBookingList.setList(ret["결과값"]);
		}
		// 동호회 최신글 완료
		, finishClubArticleList: function(ret){
			var thisClass = this;
			
			//if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objClubArticleList.spinEnd();
			this.objClubArticleList.setList(ret["결과값"]);
			
			for(var i=0;i<ret["결과값"].length;i++){
				var obj = ret["결과값"][i];
				
				// 작성자 정보
				_gf.getMemberInfo({
					"콜백": function(res, infoData, arg){
						thisClass.objClubArticleList.setWriter(arg["글코드"], infoData);
					}
					, "글코드": obj["글코드"]
					, "아이디": obj["작성자"]["아이디"]
				});
				
				// 나이스샷 회원 리스트
				this.objComm.getNiceshotMemberList({
					"글코드": obj["글코드"]
					, "타겟": thisClass.objClubArticleList
				});
			}
		}
		// 인기 동호회 완료
		, finishPopClubList: function(ret){
			//if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objPopClubList.spinEnd();
			this.objPopClubList.setList(ret["결과값"]);
		}
		// 나이스샷 완료
		, finishNiceshotList: function(ret){
			var thisClass = this;
			
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objNiceshotList.spinEnd();
			this.objNiceshotList.setList(ret["결과값"]);
			
			for(var i=0;i<ret["결과값"].length;i++){
				var obj = ret["결과값"][i];
				
				// 작성자 정보
				_gf.getMemberInfo({
					"콜백": function(res, infoData, arg){
						thisClass.objNiceshotList.setWriter(arg["글코드"], infoData, arg["게시판종류"]);
					}
					, "글코드": obj["글코드"]
					, "게시판종류": obj["게시판종류"]
					, "아이디": obj["작성자"]["아이디"]
				});
				
				// 나이스샷 회원 리스트
				this.objComm.getNiceshotMemberList({
					"글코드": obj["글코드"]
					, "게시판종류": obj["게시판종류"]
					, "타겟": thisClass.objNiceshotList
				});
			}
		}
		// 나이스샷 회원리스트 완료
		, finishNiceshotMemberList: function(ret){
			var thisClass = this;
			
			//if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			ret["타겟"].setNiceshotList(ret["글코드"], ret["결과값"], ret["게시판종류"]);
		}
		// 공지사항 완료
		, finishNoticeList: function(ret){
			//if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objNoticeList.spinEnd();
			this.objNoticeList.setList(ret["결과값"]);
		}
		// 부킹 검색
		, getBookingList: function(){
			var n = this.objWeekendBookingTab.getIdx();
			var thisClass = this;
			
			switch(n){
				case 0:
					this.objRecommBookingList.hide();
					
					this.objWeekendBookingList.spinStart();
					this.objComm.getWeekendBookingList({
						"콜백": function(ret){
							thisClass.finishWeekendBookingList(ret);
						}
					});
					break;
				case 1:
					this.objWeekendBookingList.hide();
					
					this.objRecommBookingList.spinStart();
					this.objComm.getRecommBookingList({
						"콜백": function(ret){
							thisClass.finishRecommBookingList(ret);
						}
					});
			}
		}
		// 조인룸 이동
		, goJoinroomViewPage: function(seq){
			var szLink = _ROOT + "/booking/join_room_view01.html?q_seq=" + seq;
			document.location.href = szLink;
		}
		// 동호회 이동
		, goClubPage: function(seq){
			var szLink = _ROOT + "/self_club/home.html?club_seq=" + seq;
			
			$("body").append("<a href='" + szLink + "' target='_blank' id='idPermissionLink''></a>");
			$("a:last").get(0).click();
		}
		// 동호회 게시판 이동
		, goClubBoardViewPage: function(clubSeq, seq){
			var szLink = _ROOT + "/self_club/club_view.html?club_seq=" + clubSeq + "&board_seq=" + seq;
			
			$("body").append("<a href='" + szLink + "' target='_blank' id='idPermissionLink''></a>");
			$("a:last").get(0).click();
		}
		// 동호회 사진 게시판 이동
		, goClubImageBoardViewPage: function(clubSeq, seq){
			var szLink = _ROOT + "/self_club/club_picture_view.html?club_seq=" + clubSeq + "&board_seq=" + seq;
			
			$("body").append("<a href='" + szLink + "' target='_blank' id='idPermissionLink'></a>");
			$("a:last").get(0).click();
		}
		// 코스공략 게시판 이동
		, goCourseViewPage: function(seq){
			var szLink = _ROOT + "/course/course_view.html?q_seq=" + seq;
			document.location.href = szLink;
		}
		// 공지사항 리스트 이동
		, goNoticeListPage: function(){
			var szLink = _ROOT + "/launge/notice.html";
			document.location.href = szLink;
		}
		// 공지사항 상세 이동
		, goNoticeViewPage: function(seq){
			var szLink = _ROOT + "/launge/notice_view.html?notice_seq=" + seq;
			document.location.href = szLink;
		}
		// 예약 리스트 이동
		, goReserveListPage: function(areaKey, golfKey, courseKey, sDate){
			var szLink = _ROOT + "/booking/reserve_list.html?q_area=" + areaKey + "&q_golf=" + golfKey + "&q_course=" + courseKey + "&q_date=" + sDate.getTime();
			document.location.href = szLink;
		}
		// 상세 예약 이동
		, goReserveViewPage: function(reserveKey, areaKey, golfKey, courseKey, sDate){
			var szLink = _ROOT + "/booking/reserve_view.html?q_reserve=" + reserveKey + "&q_area=" + areaKey + "&q_golf=" + golfKey + "&q_course=" + courseKey + "&q_date=" + sDate.getTime();
			document.location.href = szLink;
		}
	}
	
	document.objControl = new clsControl();
	document.objControl._init();
});